public class Hanio {
    public static void main(String[] args) {
        hanio(2,'A','B','C');
        System.out.println();
        hanio(3,'A','B','C');
        System.out.println();
        hanio(4,'A','B','C');
        System.out.println();
    }
    public static void move(char post1,char post2) {
        System.out.print(post1+"=>"+post2+' ');
    }
    //n代表盘子数目
    //post1代表起始位置
    //post2代表中转位置
    //post3代表最终位置
    public static void hanio(int n,char post1,char post2,char post3) {
        if(n==1) {
            move(post1, post3);
            return;
        }
            hanio(n-1,post1,post3,post2);
            move(post1,post3);
            hanio(n-1,post2,post1,post3);
    }

}
